This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# just a car class | |
class Car | |
# @return [String] | |
attr_accessor :name | |
# @return [String] | |
attr_accessor :color | |
# @return [Integer] | |
attr_accessor :year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car | |
attr_writer :name | |
def initialize(name) | |
@name = name | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car | |
attr_accessor :name | |
def initialize(name) | |
@name = name | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
private name: string = ''; | |
public getName(): string { | |
return this.name; | |
} | |
public setName(name: string): void { | |
this.name = name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext } from 'react'; | |
import { Form, Button, Card, Row, Col } from 'react-bootstrap'; | |
import { useFormik } from 'formik'; | |
import { ItemsContext } from '../../contexts/itemsContext'; | |
import validate from './validation'; | |
export default function ItemsForm() { | |
const { createItem } = useContext(ItemsContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext } from 'react'; | |
import { Table, Button } from 'react-bootstrap'; | |
import { ItemsContext } from '../../contexts/itemsContext'; | |
export default function ItemsList() { | |
const { removeItem, items } = useContext(ItemsContext); | |
const onClickRemove = (index) => () => { | |
removeItem(index); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Container, Row, Col } from 'react-bootstrap'; | |
import { ItemsProvider } from './contexts/itemsContext'; | |
import ItemsList from './components/itemsList/itemsList'; | |
import ItemsForm from './components/itemsForm/itemsForm'; | |
import './App.scss'; | |
function App() { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext, useState } from 'react'; | |
const ItemsContext = createContext({ | |
items: [], | |
createItem: () => {}, | |
removeItem: () => {}, | |
}); | |
const ItemsProvider = ({ children }) => { | |
const [items, setItems] = useState([]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.4 | |
MAINTAINER exAspArk <exAspArk@gmail.com> | |
RUN \ | |
# update packages | |
apk update && apk upgrade && \ | |
# install ruby | |
apk --no-cache add ruby ruby-dev ruby-bundler ruby-json ruby-irb ruby-rake ruby-bigdecimal && \ |
NewerOlder